<template>
  <div>
    <div>9999</div>
    <mt-button @click="getDate">选择时间</mt-button>
    <mt-button @click="showDate">时间Filter  {{date}}</mt-button>
    <mt-popup v-model="popupVisible">
      <span>8888</span>
    </mt-popup>
    <mt-datetime-picker ref="picker"
                        type="date"
                        year-format="{value}年"
                        month-format="{value}月"
                        date-format="{value}日"
                        v-model="pickerValue" @confirm="handleConfirm" :startTime="startTime"></mt-datetime-picker>

  </div>
</template>
<script>
import { Button, DatetimePicker, Popup, Toast } from 'mint-ui'
import ajaxService from '@/common/ajaxService.js'
import dateFilter from '@/common/dateFilter.js'
export default {
  data () {
    return {
      pickerValue: new Date(),
      popupVisible: false,
      startTime: '',
      date: '1111'
    }
  },
  methods: {
    openPicker () {
      this.$refs.picker.open()
      Toast({
        message: '开通申请已提交',
        position: 'bottom',
        duration: '3000'
      })
    },
    getDate () {
      // this.popupVisible = true
      this.$refs.picker.open()
      ajaxService.postService('auth/login', {username: 'admin', password: '123456'}).then(function (res) {
        console.log(res)
      })
    },
    handleConfirm (date) {
      console.log(date)
    },
    showDate () {
      this.date = dateFilter.formatDate(new Date(), 'yyyy/MM/dd')
    }
  },
  components: {
    'mt-button': Button,
    'mt-datetime-picker': DatetimePicker,
    'mt-popup': Popup
  }
}
</script>
<style>

</style>
